package com.sjn.Client;

import com.sjn.screen.ScreencomposingRoom;

import java.util.Scanner;


public class screenstart implements StartService{
    ScreencomposingRoom screencomposingRoom = null;
    //收集框架
    String fr =null;
    //收集蓝图
    String bp = null;
    //制作
    String m = null;
     Scanner sc=new Scanner(System.in);
    @Override
    public String toString() {
        return "屏幕{" +
                ", 框架='" + fr + '\'' +
                ", 蓝图='" + bp + '\'' +
                ", 制作情况='" + m + '\'' +
                '}';
    }
     @Override
    public void start(int proess){
        {
            //--------------------代工厂start----------------------
            while(proess==3){
                System.out.println("-----进入屏幕制作界面-----");
                System.out.println("-----按1选择屏幕代工厂-----");
                System.out.println("-----按2选择屏幕蓝图-----");
                System.out.println("-----按3构造屏幕框架------");
                System.out.println("-----按4选择进行屏幕制作-----");
                System.out.println("-----按5结束制作进程------");
                int screenproess = sc.nextInt();
                if (screenproess==5){
                    System.out.println("屏幕制作结束!");
                    break;
                }


                while(screenproess == 1){
                    //搭建屏幕
                    //创建子线程用于选择代工厂
                    System.out.println("-----按1选择三  星------");
                    System.out.println("-----按2选择富士康------");
                    int screenproesss = sc.nextInt();
                    screencomposingRoom = new ScreencomposingRoom();
                    System.out.println("选择:" + screencomposingRoom.Foundry(screenproesss));
                    break;
                }
                //--------------------代工厂end----------------------
                //--------------------蓝图start----------------------
                while (screenproess==2){
                    if (screencomposingRoom==null){
                        System.out.println("添加失败,请先选择代工厂");
                        break;
                    }
                    System.out.println("------进入蓝图制作界面------");
                    System.out.println("------请依次输入整数x y 以及需要的技术:");
                    bp =  screencomposingRoom.Blueprint(sc.nextInt(),sc.nextInt(),sc.nextLine());
                    System.out.println(bp);
                    if (bp!=null){
                        break;
                    }

                }
                //--------------------蓝图end----------------------
                //--------------------制作start----------------------
                while (screenproess==4){
                    if (screencomposingRoom==null){
                        System.out.println("添加失败,请先选择代工厂");
                        break;
                    }
                    System.out.println("------进入制作界面,相机工厂自动制作-----");
                    m = screencomposingRoom.Production();
                    System.out.println(m);
                    break;
                }
                //--------------------制作end----------------------
                //--------------------框架start----------------------
                while (screenproess==3){

                    System.out.println("-----请按1选择高级方案-----");
                    System.out.println("-----请按2添加中级方案-----");
                    System.out.println("-----请按3添加普通方案-----");
                    System.out.println("-----请按4退出方案-----");

                    int screenproesss = sc.nextInt();

                    if (screencomposingRoom==null){
                        System.out.println("添加失败,请先选择代工厂");
                        break;
                    }
                    else if (screenproesss==1&&screencomposingRoom!=null){
                        fr = ""+screencomposingRoom.Frameworks(screenproesss);
                        System.out.println(fr);
                    }
                    else if (screenproesss==2&&screencomposingRoom!=null){
                        fr = ""+screencomposingRoom.Frameworks(screenproesss);
                        System.out.println(fr);
                    }
                    else if (screenproesss==3&&screencomposingRoom!=null){
                        fr = ""+screencomposingRoom.Frameworks(screenproesss);
                        System.out.println(fr);
                    }

                    if (screenproesss==4){
                        break;
                    }




                }
                //--------------------框架end----------------------

            }

        }
    }
}
